package com.cn.wanxi.servlet;

import com.cn.wanxi.model.CompanyModel;
import com.cn.wanxi.model.NavModel;
import com.cn.wanxi.service.CompanyService;
import com.cn.wanxi.service.NavService;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet("/main")
public class MainServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {

//        req.setAttribute("advertisement1","极致优雅");
//        req.setAttribute("advertisement2","只为让你的美与众不同");

//        CompanyService companyService = new CompanyService();
//        CompanyModel companyModel = companyService.getCompanyModel();
//        req.setAttribute("companyModel", companyModel);
//
//        NavService navService = new NavService();
//        NavModel[] navModels = navService.getNavModels();
//        req.setAttribute("navModels", navModels);

        CommonServlet.setCompanyAndNavData(req);


        req.getRequestDispatcher("/jsp/main.jsp").forward(req, resp);
    }
}
